package com.woniuxy.background.dao;

import com.woniuxy.background.pojo.Menu;
import com.woniuxy.background.pojo.RoleMenu;
import com.woniuxy.background.pojo.RoleMenuKey;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Mapper
@Component
public interface RoleMenuMapper {
    int deleteByPrimaryKey(RoleMenuKey key);

    int insert(RoleMenu record);

    int insertSelective(RoleMenu record);

    RoleMenu selectByPrimaryKey(RoleMenuKey key);

    int updateByPrimaryKeySelective(RoleMenu record);

    int updateByPrimaryKey(RoleMenu record);

    void saveRolesMenus(List<RoleMenuKey> list);

    @Delete("delete from role_menu where role_id = #{value}")
    void deleteByRoleId(int roleId);

    @Select("select * from role_menu where menu_id = #{value}")
    List<Menu> selectByMeunId(int id);
}